package com.woniuxy.controller;


import com.woniuxy.entity.CommentReplay;
import com.woniuxy.result.Result;
import com.woniuxy.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.lang.reflect.Field;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author linKe
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/index")
    public String one() {
        return "时候";
    }


    @PostMapping("")
    public Result<?> saveUser(@RequestBody CommentReplay user) {

        System.out.println(user.getId());
        Field[] fields = user.getClass().getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
        return new Result<>("200","ok",user);
    }
}
